package org.cskt.sl.sys.service.impl;

import java.util.List;

import org.cskt.sl.sys.dao.MessageMapper;
import org.cskt.sl.sys.entity.Message;
import org.cskt.sl.sys.example.MessageExample;
import org.cskt.sl.sys.service.MessageService;
import org.cskt.sl.util.Pager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MessageServiceImpl implements MessageService {

	@Autowired
	private MessageMapper messageMapper;
	
	@Override
	public int countByExample(MessageExample example) {
		// TODO Auto-generated method stub
		return messageMapper.countByExample(example);
	}

	@Override
	public int deleteMessageById(Integer mid) {
		// TODO Auto-generated method stub
		return messageMapper.deleteByPrimaryKey(mid);
	}

	@Override
	public int addMessage(Message record) {
		// TODO Auto-generated method stub
		return messageMapper.insertSelective(record);
	}

	@Override
	public List<Message> findMessagePageList(MessageExample example, Pager pager) {
		// TODO Auto-generated method stub
		return messageMapper.selectByExample(example, (pager.getCurrentPage()-1)*pager.getPageSize(), pager.getCurrentPage()*pager.getPageSize());
	}

	@Override
	public Message getMessageById(Integer mid) {
		// TODO Auto-generated method stub
		return messageMapper.selectByPrimaryKey(mid);
	}

	@Override
	public int updateMessageById(Message record) {
		// TODO Auto-generated method stub
		return messageMapper.updateByPrimaryKey(record);
	}

}
